/**
 * <copyright>
 * </copyright>
 *

 */
package com.ldh.mod4j.businessdomain.businessDomainDsl.impl;

import com.ldh.mod4j.businessdomain.businessDomainDsl.BusinessDomainDslPackage;
import com.ldh.mod4j.businessdomain.businessDomainDsl.Property;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Property</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.ldh.mod4j.businessdomain.businessDomainDsl.impl.PropertyImpl#isNullable <em>Nullable</em>}</li>
 *   <li>{@link com.ldh.mod4j.businessdomain.businessDomainDsl.impl.PropertyImpl#isDerived <em>Derived</em>}</li>
 *   <li>{@link com.ldh.mod4j.businessdomain.businessDomainDsl.impl.PropertyImpl#isWritable <em>Writable</em>}</li>
 *   <li>{@link com.ldh.mod4j.businessdomain.businessDomainDsl.impl.PropertyImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link com.ldh.mod4j.businessdomain.businessDomainDsl.impl.PropertyImpl#getName <em>Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PropertyImpl extends MinimalEObjectImpl.Container implements Property
{
  /**
   * The default value of the '{@link #isNullable() <em>Nullable</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isNullable()
   * @generated
   * @ordered
   */
  protected static final boolean NULLABLE_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isNullable() <em>Nullable</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isNullable()
   * @generated
   * @ordered
   */
  protected boolean nullable = NULLABLE_EDEFAULT;

  /**
   * The default value of the '{@link #isDerived() <em>Derived</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isDerived()
   * @generated
   * @ordered
   */
  protected static final boolean DERIVED_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isDerived() <em>Derived</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isDerived()
   * @generated
   * @ordered
   */
  protected boolean derived = DERIVED_EDEFAULT;

  /**
   * The default value of the '{@link #isWritable() <em>Writable</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isWritable()
   * @generated
   * @ordered
   */
  protected static final boolean WRITABLE_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isWritable() <em>Writable</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isWritable()
   * @generated
   * @ordered
   */
  protected boolean writable = WRITABLE_EDEFAULT;

  /**
   * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected static final String DESCRIPTION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected String description = DESCRIPTION_EDEFAULT;

  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected PropertyImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return BusinessDomainDslPackage.Literals.PROPERTY;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isNullable()
  {
    return nullable;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setNullable(boolean newNullable)
  {
    boolean oldNullable = nullable;
    nullable = newNullable;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.PROPERTY__NULLABLE, oldNullable, nullable));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isDerived()
  {
    return derived;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDerived(boolean newDerived)
  {
    boolean oldDerived = derived;
    derived = newDerived;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.PROPERTY__DERIVED, oldDerived, derived));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isWritable()
  {
    return writable;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setWritable(boolean newWritable)
  {
    boolean oldWritable = writable;
    writable = newWritable;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.PROPERTY__WRITABLE, oldWritable, writable));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDescription()
  {
    return description;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDescription(String newDescription)
  {
    String oldDescription = description;
    description = newDescription;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.PROPERTY__DESCRIPTION, oldDescription, description));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.PROPERTY__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case BusinessDomainDslPackage.PROPERTY__NULLABLE:
        return isNullable();
      case BusinessDomainDslPackage.PROPERTY__DERIVED:
        return isDerived();
      case BusinessDomainDslPackage.PROPERTY__WRITABLE:
        return isWritable();
      case BusinessDomainDslPackage.PROPERTY__DESCRIPTION:
        return getDescription();
      case BusinessDomainDslPackage.PROPERTY__NAME:
        return getName();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case BusinessDomainDslPackage.PROPERTY__NULLABLE:
        setNullable((Boolean)newValue);
        return;
      case BusinessDomainDslPackage.PROPERTY__DERIVED:
        setDerived((Boolean)newValue);
        return;
      case BusinessDomainDslPackage.PROPERTY__WRITABLE:
        setWritable((Boolean)newValue);
        return;
      case BusinessDomainDslPackage.PROPERTY__DESCRIPTION:
        setDescription((String)newValue);
        return;
      case BusinessDomainDslPackage.PROPERTY__NAME:
        setName((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case BusinessDomainDslPackage.PROPERTY__NULLABLE:
        setNullable(NULLABLE_EDEFAULT);
        return;
      case BusinessDomainDslPackage.PROPERTY__DERIVED:
        setDerived(DERIVED_EDEFAULT);
        return;
      case BusinessDomainDslPackage.PROPERTY__WRITABLE:
        setWritable(WRITABLE_EDEFAULT);
        return;
      case BusinessDomainDslPackage.PROPERTY__DESCRIPTION:
        setDescription(DESCRIPTION_EDEFAULT);
        return;
      case BusinessDomainDslPackage.PROPERTY__NAME:
        setName(NAME_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case BusinessDomainDslPackage.PROPERTY__NULLABLE:
        return nullable != NULLABLE_EDEFAULT;
      case BusinessDomainDslPackage.PROPERTY__DERIVED:
        return derived != DERIVED_EDEFAULT;
      case BusinessDomainDslPackage.PROPERTY__WRITABLE:
        return writable != WRITABLE_EDEFAULT;
      case BusinessDomainDslPackage.PROPERTY__DESCRIPTION:
        return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
      case BusinessDomainDslPackage.PROPERTY__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (nullable: ");
    result.append(nullable);
    result.append(", derived: ");
    result.append(derived);
    result.append(", writable: ");
    result.append(writable);
    result.append(", description: ");
    result.append(description);
    result.append(", name: ");
    result.append(name);
    result.append(')');
    return result.toString();
  }

} //PropertyImpl
